package 特殊操作流.Properties.Properties和IO流结合的方法;

import java.io.*;
import java.util.Properties;

public class PropertiesDemo04 {
    public static void main(String[] args) throws IOException {
//        myStory();
        myLoad();

    }

    private static void myLoad() throws IOException{
        Properties prop=new Properties();
        //void load(Reader reader):从输入字符流读取属性列表（键和元素对）
        InputStreamReader isr=new InputStreamReader(new FileInputStream("fw1.txt"));
        prop.load(isr);
        isr.close();
        System.out.println(prop);
    }

    private static void myStory() throws IOException {
        Properties prop = new Properties();
        prop.setProperty("666", "姜恒星");
        prop.setProperty("66", "郝万杰");
        prop.setProperty("6", "邓吉壕");

        OutputStreamWriter osr = new OutputStreamWriter(new FileOutputStream("fw1.txt"));
//void store(Writer writer, String comments):将此属性列表（键和元素对）写入此 Properties表中，以适合使用 load(Reader)方法的格式
            //创建数据源文件
        prop.store(osr,null);
        osr.close();
        }
    }
